<?php

use App\Http\Controllers\Api\IndexController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\PostsController;
use App\Http\Controllers\Api\UploadsController;
use App\Http\Controllers\Api\CircleController;
use App\Http\Controllers\Api\CommonController;
use App\Http\Controllers\Api\CommentController;
use App\Http\Controllers\Api\FeedbackController;
use App\Http\Controllers\Api\MessagesController;
use App\Http\Controllers\Api\TagsController;
use App\Http\Controllers\Api\ChatController;
use App\Http\Controllers\Api\OrderController;


/**
 * 需要登录
 */
Route::group(
    ['prefix' => 'v1', 'namespace' => 'Api', 'middleware' => 'auth.api'], function () {
    //  测试
//    Route::get('index', [IndexController::class, 'test']);
    //  上传文件
    Route::post('/files/uploads', [UploadsController::class, 'putFile']);

    // 获取用户信息
    Route::get('/user/info', [UserController::class, 'userInfo']);

    //添加圈子
    Route::post('/posts/add/circle', [PostsController::class, 'createCircle']);


    /**
     * 消息
     */
    // 消息页数据
    Route::get('/massages/info', [MessagesController::class, 'getMessages']);
    // 通知详情页数据
    Route::get('/massages/getDetailsMessages', [MessagesController::class, 'getDetailsMessages']);
    // 已读对应类通知
    Route::get('/massages/readMessages', [MessagesController::class, 'readMessages']);
    // 发起聊天
    Route::post('/massages/addChat', [ChatController::class, 'addChat']);
    // 查询用户聊天记录
    Route::get('/massages/getUserChat', [ChatController::class, 'getUserChat']);
    // 查询用户聊天记录列表
    Route::get('/massages/getUserChatList', [MessagesController::class, 'getUserChatList']);
    // 已读对应用户信息
    Route::get('/massages/readUserChat', [ChatController::class, 'readUserChat']);
    // 用户删除聊天记录
    Route::get('/massages/userDelMessage', [ChatController::class, 'userDelMessage']);


    /**
     * 用户
     */
    // 更新用户资料
    Route::post('/user/update/info', [UserController::class, 'updateInfo']);
    // 关注
    Route::post('/user/follow', [PostsController::class, 'followUser']);
    // 反馈
    Route::post('/feedback/add', [FeedbackController::class, 'addFeedback']);
    // 获取会员价格
    Route::get('/getMembersPrice', [OrderController::class, 'getMembersPrice']);
    // 用户订单信息
    Route::get('/user/myOrder', [UserController::class, 'myOrder']);
    // 用户收益
    Route::get('/user/myFinancial', [UserController::class, 'myFinancial']);
    // 用户发起提现
    Route::post('/user/initiateWithdrawal', [UserController::class, 'initiateWithdrawal']);
    // 用户提现记录
    Route::get('/user/myUserWithdrawal', [UserController::class, 'myUserWithdrawal']);
    // 用户收益记录
    Route::get('/user/myUserExceptional', [UserController::class, 'myUserExceptional']);
    // 免费领会员
    Route::get('/user/freeGetVip', [UserController::class, 'freeGetVip']);
    // 用户删除搜索记录
    Route::get('/user/myDelSearch', [CommonController::class, 'myDelSearch']);
    // 用户删除全部搜索记录
    Route::get('/user/myDelAllSearch', [CommonController::class, 'myDelAllSearch']);

    /**
     * 帖子
     */
    // 发帖时推荐的标签
    Route::get('/tags/recommend', [PostsController::class, 'recommendTags']);
    // 发帖时添加标签
    Route::post('/tags/add', [PostsController::class, 'addTag']);
    // 发帖
    Route::post('/post/add', [PostsController::class, 'addPost']);
    // 用户关注圈子
    Route::post('/user/follow/circle', [CircleController::class, 'followCircle']);
    // 点赞
    Route::post('/posts/like', [PostsController::class, 'like']);
    // 收藏collect
    Route::post('/posts/collect', [PostsController::class, 'collect']);
    // 删除
    Route::post('/posts/delete', [PostsController::class, 'deletePosts']);
    // 我的帖子列表
    Route::get('/user/posts', [UserController::class, 'getMyPosts']);
    // 添加评论
    Route::post('/comment/add', [CommentController::class, 'add']);
    // 点赞评论
    Route::post('/comment/like/add', [CommentController::class, 'commentAddLike']);
    // 用户认证
    Route::post('/user/authentication', [UserController::class, 'authentication']);
    // 我的认证信息
    Route::get('/user/authentication', [UserController::class, 'getAuthentication']);
    // 我创建的圈子列表
    Route::get('/user/cricle', [UserController::class, 'myCircle']);
    // 个人中心文章统计
    Route::get('/user/totalPost', [UserController::class, 'totalPost']);
    // 我关注的用户列表
    Route::get('/user/followUser', [UserController::class, 'myFollowUsers']);
    // 我的粉丝用户列表
    Route::get('/user/fansUser', [UserController::class, 'myFansUsers']);
    // 删除评论
    Route::post('/comment/delete', [CommentController::class, 'delComment']);

    // 添加用户板块
    Route::post('/user/plate/add', [UserController::class, 'addUserPlate']);
    // 删除用户板块
    Route::post('/user/plate/delete', [UserController::class, 'deleteUserPlate']);
    // 审核通过圈子
    Route::post('/user/auditPosts', [PostsController::class, 'auditPosts']);
    // 用户关注的圈子文章列表
    Route::get('/user/follow/CircleList', [CircleController::class, 'userFollowCircleList']);


    // 订单
    Route::post('/order', [OrderController::class, 'order']);

});


/**
 * 不需要登录
 */
Route::group(
    ['prefix' => 'v1', 'namespace' => 'Api'], function ($app) {
    // 支付通知
    Route::any('/notify', [\App\Http\Controllers\Api\NotifyController::class, 'index']);
    // 测试
    Route::get('/test', [IndexController::class, 'test']);
    // 登录
    Route::post('/login', [UserController::class, 'login']);
    // 轮播图
    Route::get('/index/banner', [IndexController::class, 'banner']);
    // 热门
    Route::get('/index/choiceness', [IndexController::class, 'choiceness']);
    // Token
    Route::get('/token', [PostsController::class, 'token']);
    // 板块列表
    Route::get('/posts/plate/list', [PostsController::class, 'plateList']);
    // 通过板块获取圈子
    Route::get('/posts/circle/byplateid', [PostsController::class, 'getCircleByPlateId']);
    // 搜索圈子
    Route::get('/posts/circle/search', [PostsController::class, 'searchCircle']);
    // 推荐圈子
    Route::get('/circle/recommend', [CircleController::class, 'recommendCircle']);
    // 热门圈子
    Route::get('/circle/hot', [CircleController::class, 'hotCircle']);
    // 最新圈子
    Route::get('/circle/new', [CircleController::class, 'newCircle']);
    // 全部圈子
    Route::get('/circle/list', [CircleController::class, 'list']);
    // 圈子文章组合
    Route::get('/circle/circleAndPosts', [CircleController::class, 'circleAndPosts']);
    // 获取首页文章列表
    Route::get('/index/posts', [IndexController::class, 'getPosts']);
    // 获取帖子详情
    Route::get('/posts/detail', [PostsController::class, 'postsDetail']);
    // 获取圈子详细
    Route::get('/circle/info', [CircleController::class, 'getCircleInfoById']);
    // 通过圈子id获取
    Route::get('/posts/byCircleId', [PostsController::class, 'postsByCircle']);
    // 首页搜索
    Route::get('/index/search', [CommonController::class, 'search']);
    // 搜索数量
    Route::get('/search/count', [CommonController::class, 'searcheCountJson']);
    // 热门搜索关键字列表
    Route::get('/search/hot/list', [CommonController::class, 'hotSearch']);
    // 首页轮播搜索关键字列表
    Route::get('/search/carousel/list', [CommonController::class, 'HomeCarousel']);
    // 通过帖子ID获取评论列表
    Route::get('/comment/byPostsId', [CommentController::class, 'getCommentByPostsId']);
    // 获取热门标签
    Route::get('/tags/hot', [TagsController::class, 'hotTags']);
    // 根据标签获取帖子列表
    Route::get('/posts/tags', [PostsController::class, 'listByTagId']);
    // 根据标签获取帖子列表
    Route::get('/posts/tagsv2', [PostsController::class, 'listByTagIdV2']);
    // 用户板块列表
    Route::get('/user/plate', [UserController::class, 'userPlate']);
    // 通过用户id获取用户信息
    Route::get('/user/info/byUserId', [UserController::class, 'userInfoByUserId']);
    // 通过用户id获取用户发表的帖子
    Route::get('/user/posts/byUserId', [UserController::class, 'postsByUserId']);
    // 获取条款
    Route::get('/common/getClauseDetail', [CommonController::class, 'getClauseDetail']);
    // 获取分享海报
    Route::get('/posts/makeShowQcode', [PostsController::class, 'makeShowQcode']);
    // 下单
    Route::get('/orders', [OrderController::class, 'orders']);
    // 获取配置
    Route::get('/configData', [CommonController::class, 'configData']);
    // 查询用户是否有未读信息
    Route::get('/massages/getSysMessageCount', [MessagesController::class, 'getSysMessageCount']);
    // 查询帖子打赏信息
    Route::get('/posts/getExceptionalList', [PostsController::class, 'getExceptionalList']);
    // 用户搜索列表
    Route::get('/search/my/list', [CommonController::class, 'mySearch']);
    // 板块选择列表
    Route::get('/posts/plate/options', [PostsController::class, 'plateOptions']);
    // 关注圈子用户列表
    Route::get('/circle/getCircleUserList', [CircleController::class, 'getCircleUserList']);

});



